IF(WIN32)
	IF(MSVC)
		IF((CMAKE_GENERATOR_PLATFORM STREQUAL "x64") OR (CMAKE_GENERATOR MATCHES "Win64"))
			SET(KLAYGE_ARCH_NAME "x64")
			SET(KLAYGE_VS_PLATFORM_NAME "x64")
		ELSEIF((CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") OR (CMAKE_GENERATOR MATCHES "ARM64"))
			SET(KLAYGE_ARCH_NAME "arm64")
			SET(KLAYGE_VS_PLATFORM_NAME "ARM64")
		ELSEIF((CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") OR (CMAKE_GENERATOR MATCHES "ARM"))
			SET(KLAYGE_ARCH_NAME "arm")
			SET(KLAYGE_VS_PLATFORM_NAME "ARM")
		ELSE()
			MESSAGE(FATAL_ERROR "This CPU architecture is not supported")
		ENDIF()
	ENDIF()
	IF(WINDOWS_STORE)
		SET(KLAYGE_PLATFORM_NAME "win_store")
		SET(KLAYGE_PLATFORM_WINDOWS_STORE TRUE)
	ELSE()
		SET(KLAYGE_PLATFORM_NAME "win")
		SET(KLAYGE_PLATFORM_WINDOWS_DESKTOP TRUE)
	ENDIF()
	SET(KLAYGE_PLATFORM_WINDOWS TRUE)
ELSEIF(ANDROID)
	SET(KLAYGE_PLATFORM_NAME "android")
	SET(KLAYGE_PLATFORM_ANDROID TRUE)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
	SET(KLAYGE_PLATFORM_NAME "linux")
	SET(KLAYGE_PLATFORM_LINUX TRUE)
ELSEIF(IOS)
	SET(KLAYGE_PLATFORM_NAME "ios")
	SET(KLAYGE_PLATFORM_IOS TRUE)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
	IF(IOS)
		SET(KLAYGE_PLATFORM_NAME "ios")
		SET(KLAYGE_PLATFORM_IOS TRUE)
	ELSE()
		SET(KLAYGE_PLATFORM_NAME "darwin")
		SET(KLAYGE_PLATFORM_DARWIN TRUE)
	ENDIF()
ENDIF()

IF(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
	SET(KLAYGE_HOST_PLATFORM_NAME "win")
	SET(KLAYGE_HOST_PLATFORM_WINDOWS TRUE)
ELSEIF(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
	SET(KLAYGE_HOST_PLATFORM_NAME "linux")
	SET(KLAYGE_HOST_PLATFORM_LINUX TRUE)
ELSEIF(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
	SET(KLAYGE_HOST_PLATFORM_NAME "darwin")
	SET(KLAYGE_HOST_PLATFORM_DARWIN TRUE)
ENDIF()

IF(NOT KLAYGE_ARCH_NAME)
	IF((CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64") OR (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"))
		SET(KLAYGE_ARCH_NAME "x64")
	ELSE()
		SET(KLAYGE_ARCH_NAME "x86")
	ENDIF()
ENDIF()

IF((CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "AMD64") OR (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64"))
	SET(KLAYGE_HOST_ARCH_NAME "x64")
ELSE()
	SET(KLAYGE_HOST_ARCH_NAME "x86")
ENDIF()

SET(KLAYGE_PLATFORM_NAME ${KLAYGE_PLATFORM_NAME}_${KLAYGE_ARCH_NAME})
SET(KLAYGE_HOST_PLATFORM_NAME ${KLAYGE_HOST_PLATFORM_NAME}_${KLAYGE_HOST_ARCH_NAME})

IF(KLAYGE_PLATFORM_ANDROID OR KLAYGE_PLATFORM_IOS)
	SET(KLAYGE_PREFERRED_LIB_TYPE "STATIC")
ELSE()
	SET(KLAYGE_PREFERRED_LIB_TYPE "SHARED")
ENDIF()

IF (KLAYGE_PLATFORM_WINDOWS_DESKTOP OR KLAYGE_PLATFORM_LINUX OR KLAYGE_PLATFORM_DARWIN)
	SET(KLAYGE_IS_DEV_PLATFORM TRUE)
ELSE()
	SET(KLAYGE_IS_DEV_PLATFORM FALSE)
ENDIF()
